package com.tis.database.entitys.promis;

import java.io.Serializable;

import javax.persistence.*;

import org.apache.commons.lang.builder.ToStringBuilder;

/**
 * The primary key class for the GL_POSTING_DETAILS database table.
 * 
 */
@Embeddable
public class GlPostingDetailPK implements Serializable {
	//default serial version id, required for serializable classes.
	private static final long serialVersionUID = 1L;

	@Column(insertable=false, updatable=false)
	private String company;

	@Column(name="VOUCHER_TYPE", insertable=false, updatable=false)
	private String voucherType;

	@Column(name="VOUCHER_SERIES", insertable=false, updatable=false)
	private String voucherSeries;

	@Column(name="VOUCHER_NUMBER", insertable=false, updatable=false)
	private long voucherNumber;

	@Column(name="GL_POSTING_SEQ_NUMBER")
	private long glPostingSeqNumber;
	
	@Override
	public String toString()
	{ 
		return ToStringBuilder.reflectionToString(this);
	}

	public GlPostingDetailPK() {
	}
	public String getCompany() {
		return this.company;
	}
	public void setCompany(String company) {
		this.company = company;
	}
	public String getVoucherType() {
		return this.voucherType;
	}
	public void setVoucherType(String voucherType) {
		this.voucherType = voucherType;
	}
	public String getVoucherSeries() {
		return this.voucherSeries;
	}
	public void setVoucherSeries(String voucherSeries) {
		this.voucherSeries = voucherSeries;
	}
	public long getVoucherNumber() {
		return this.voucherNumber;
	}
	public void setVoucherNumber(long voucherNumber) {
		this.voucherNumber = voucherNumber;
	}
	public long getGlPostingSeqNumber() {
		return this.glPostingSeqNumber;
	}
	public void setGlPostingSeqNumber(long glPostingSeqNumber) {
		this.glPostingSeqNumber = glPostingSeqNumber;
	}

	public boolean equals(Object other) {
		if (this == other) {
			return true;
		}
		if (!(other instanceof GlPostingDetailPK)) {
			return false;
		}
		GlPostingDetailPK castOther = (GlPostingDetailPK)other;
		return 
			this.company.equals(castOther.company)
			&& this.voucherType.equals(castOther.voucherType)
			&& this.voucherSeries.equals(castOther.voucherSeries)
			&& (this.voucherNumber == castOther.voucherNumber)
			&& (this.glPostingSeqNumber == castOther.glPostingSeqNumber);
	}

	public int hashCode() {
		final int prime = 31;
		int hash = 17;
		hash = hash * prime + this.company.hashCode();
		hash = hash * prime + this.voucherType.hashCode();
		hash = hash * prime + this.voucherSeries.hashCode();
		hash = hash * prime + ((int) (this.voucherNumber ^ (this.voucherNumber >>> 32)));
		hash = hash * prime + ((int) (this.glPostingSeqNumber ^ (this.glPostingSeqNumber >>> 32)));
		
		return hash;
	}
}